package cn.cjxy.springmvcdemo1.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * SpringMVC中的Controller就是单例的(使用成员变量请注意线程安全问题)
 * 注：不要忘了,配置全注解扫描包才能认识@Controller
 * @author Administrator
 */
@Controller//相当于在容器中配置了一个bean标签    控制器层注解
public class Controller03{

	@RequestMapping("/method01") //配置访问路径
	public ModelAndView method01(){
		System.out.println(this.getClass()+":method01");
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("/WEB-INF/controller.jsp");
		return modelAndView;
	}
	
	@RequestMapping("/controller/method02") //配置访问路径
	public ModelAndView method012(){
		System.out.println(this.getClass()+":method02");
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("/WEB-INF/controller.jsp");
		return modelAndView;
	}
}